var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0}), (o.dbs = void 0);
var n = t("Platforms");
(function (t) {
    t.names = new Array();
    var e = {},
        o = {},
        r = {};
    (t.init = function (n, r) {
        for (var a = n.replace(/^\s*|\s*$/g, "").split(/\s*\n\s*/), i = {}, s = a.length / 3, c = 0; c < s; c++) {
            var l = a[3 * c];
            t.names.push(l),
                (e[l] = {skel: a[3 * c + 1], texData: a[3 * c + 2], texName: null}),
                i[e[l].skel] ? (e[l].skel = i[e[l].skel]) : (i[l] = e[l].skel);
            var u = JSON.parse(e[l].texData);
            e[l].texName = u.imagePath.match(/(\w+)\.png$/)[1];
        }
        for (var p = 0, f = r; p < f.length; p++) {
            var d = f[p];
            o[d.name] = d.getTexture();
        }
    }),
        (t.getDsp = function (t) {
            var a = r[t];
            if (a);
            else {
                if (!e[t]) return console.error("木有 " + t), null;
                (r[t] = a =
                    {
                        dragonAsset: new dragonBones.DragonBonesAsset(),
                        dragonAtlasAsset: new dragonBones.DragonBonesAtlasAsset()
                    }),
                    (a.dragonAsset.dragonBonesJson = e[t].skel.replace(/"name"\s*\:\s*""/, '"name":"' + t + '"')),
                    (a.dragonAtlasAsset.atlasJson = e[t].texData.replace(/"name"\s*\:\s*""/, '"name":"' + t + '"')),
                    (a.dragonAtlasAsset.texture = o[e[t].texName]),
                    (a.dragonAtlasAsset._uuid = n.default.base64Encode(t));
            }
            var i = new cc.Node().addComponent(dragonBones.ArmatureDisplay);
            return (
                (i.dragonAsset = a.dragonAsset),
                (i.dragonAtlasAsset = a.dragonAtlasAsset),
                (i.armatureName = "Armature"),
                (i.enableBatch = !0),
                i
            );
        });
})(o.dbs || (o.dbs = {}));
